﻿#include "dialog.h"
#include "ui_dialog.h"

Dialog::Dialog(QWidget *parent)
    : QDialog(parent)
    , ui(new Ui::Dialog)
{
    ui->setupUi(this);
    // 创建自定义导航栏
    NavigationBar* navigationBar = new NavigationBar(this);
    navigationBar->addItem("主页", QPixmap(":/icons/icons/home.png"));
    navigationBar->addItem("设置", QPixmap(":/icons/icons/setting.png"));
    navigationBar->addItem("信息", QPixmap(":/icons/icons/profile.png"));

    // 设置图片大小
    navigationBar->setIconSize(QSize(32, 32)); // 设置图片大小为 32x32

    // 创建内容区域
    QLabel* contentLabel = new QLabel("Content Area", this);
    contentLabel->setAlignment(Qt::AlignCenter);

    // 设置布局
    QHBoxLayout* layout = new QHBoxLayout(this);
    layout->addWidget(navigationBar, 1); // 导航栏占 1 份
    layout->addWidget(contentLabel, 4);  // 内容区域占 4 份
    setLayout(layout);

    // 连接导航项点击事件
    connect(navigationBar, &NavigationBar::itemClicked, this, [contentLabel](int index) {
        QString text = QString("Content for item %1").arg(index);
        contentLabel->setText(text);
    });
}

Dialog::~Dialog()
{
    delete ui;
}

